#include <iostream>
#include "Parameter/include/Parameter.h"
#include "Modules/Socket/include/Socket.h"
#include "Modules/BTree/include/Btree.h"
#include "Modules/BTree/include/GameStatus.h"
#include <jsoncpp/json/json.h>

using namespace BT;

RegParam param = RegParam();

int main(int argc, char *argv[])
{
    SERVICE serv;
    serv.serverinit(param.sevip, param.sevport);
    CLIENT cli;
    cli.clientinit(param.cliip, param.cliport);
    BehaviorTreeFactory factory;
    Tree _tree;
    _tree = init_BT(factory);
    while (1)
    {
        string tmp;
        tmp = cli.clientreceive();
        if (tmp != "-1")
        {
            dataprocess(tmp);
            _tree.tickRoot();
            serv.serversend(gameinfo.index);
        }
    }
}
